package com.eastone.user.serverapi.dao.impl;

import java.util.Collections;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.eastone.user.serverapi.dao.InfoUserRoleDao;
import com.eastone.user.serverapi.model.InfoUserRole;
import com.yjx.framework.dao.impl.CommonDaoImpl;

@Repository("infoUserRoleDao")
public class InfoUserRoleDaoImpl extends CommonDaoImpl<InfoUserRole> implements InfoUserRoleDao {
	@Override
	public List<InfoUserRole> getList() {
		List<InfoUserRole> resultList = this.getSqlSession().selectList(getStatementPrefix() + ".getList");
		if (resultList == null) {
			resultList = Collections.emptyList();
		}
		return resultList;
	}

	@Override
	public int getCount() {
		Integer result = (Integer) this.getSqlSession().selectOne(getStatementPrefix() + ".getCount");
		return result != null ? result.intValue() : 0;
	}

	@Override
	public List<InfoUserRole> getByUserId(String userId) {
		return this.getSqlSession().selectList(getStatementPrefix() + ".getByUserId",userId);
	}

	@Override
	public InfoUserRole getByUserIdAndRoleId(InfoUserRole infoUserRole) {
		return this.getSqlSession().selectOne(getStatementPrefix() + ".getByUserIdAndRoleId",infoUserRole);
	}
}
